﻿using Architecture.Api.Application.Commands.SourceCommand;
using Architecture.Domain.Services.Interface;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.SourceHandler
{
    public class SourceDeleteCommandHandler : IRequestHandler<SourceDeleteCommand, int>
    {
        private readonly ISourceService _sourceService;

        public SourceDeleteCommandHandler(ISourceService sourceService)
        {
            _sourceService = sourceService;
        }

        public async Task<int> Handle(SourceDeleteCommand request, CancellationToken cancellationToken)
        {
            return await _sourceService.SourceLogicDelete(request.SourceId);
        }
    }
    public class SourceBatchDeleteCommandHandler : IRequestHandler<SourceBatchDeleteCommand, int>
    {
        private readonly ISourceService _sourceService;

        public SourceBatchDeleteCommandHandler(ISourceService sourceService)
        {
            _sourceService = sourceService;
        }

        public async Task<int> Handle(SourceBatchDeleteCommand request, CancellationToken cancellationToken)
        {
            return await _sourceService.SourceBacthLogicDelete(request.SourceIds);
        }
    }
}
